import axios from 'axios'
//获取示例参数
var header = { "auth": "jhecis" };
export function GetExampleApi(func) {
    axios({
        
        method: 'get',
        url: '/api/Control/ExampleApi',
        headers: header,
        responseType: 'json'
    }).then(function (response) {
        func(response.data);
    }).catch(function (error) {
        console.log(error);
    });
}
export function GetExampleCorn(func) {
    console.log('请求前打印');
    axios({

       
        method: 'get',
        url: '/api/Control/ExampleCorn',
        headers: header,
        responseType: 'json'
    }).then(function (response) {
        func(response.data);
    }).catch(function (error) {
        console.log(error);
    });
}


export function GetExampleDll(func) {
    axios({
       
        method: 'get',
        url: '/api/Control/ExampleDll',
        headers: header,
        responseType: 'json'
    }).then(function (response) {
        func(response.data);
    }).catch(function (error) {
        console.log(error);
    });
}

export function GetExampleSql(func) {
    axios({
        method: 'get',
        url: '/api/Control/ExampleSql',
        headers: header,
        responseType: 'json'
    }).then(function (response) {
        func(response.data);
    }).catch(function (error) {
        console.log(error);
    });
}

/*
执行添加定时器任务
*/
export function RequestTimer(url, dt, func) {
    //最终地址http://localhost:9196/api/Control/AddTimer
    var restype = 'json';
    axios({

        method: 'post',
        data: JSON.parse(dt),
        url: '/api/Control/' + url,
        headers: header,
        responseType: restype
    }).then(function (response) {
        console.log(response.data);
        func(response.data)
    }).catch(function (error) {
        console.log(error);
        func(false);
    });
}